﻿Imports System.Math
Public Class FormPrincip
    Public Function CreerAlien()
        ' vaisseau.Location = New Point(10, 10)
        Return 0
    End Function
    Public Function CreerVaisseau()
        '  vaisseau.Location = New Point(10, 10)
        Return 0
    End Function
    Public Function ini()
        CreerVaisseau()
        CreerAlien()
        Return 0
    End Function
    Public Function AlienMove()
        If (PictureBox4.Location.X <= PictureBox4.Location.X = 849) Then
            PictureBox1.Location = New Point(3.02 + PictureBox1.Location.X, Sin(20) + PictureBox1.Location.Y)
            PictureBox2.Location = New Point(3.02 + PictureBox2.Location.X, Sin(20) + PictureBox2.Location.Y)
            PictureBox3.Location = New Point(3.02 + PictureBox3.Location.X, Sin(20) + PictureBox3.Location.Y)
            PictureBox4.Location = New Point(3.02 + PictureBox4.Location.X, Sin(20) + PictureBox4.Location.Y)
            PictureBox5.Location = New Point(3.02 + PictureBox5.Location.X, Sin(20) + PictureBox5.Location.Y)
            PictureBox6.Location = New Point(3.02 + PictureBox6.Location.X, Sin(20) + PictureBox6.Location.Y)
            PictureBox7.Location = New Point(3.02 + PictureBox7.Location.X, Sin(20) + PictureBox7.Location.Y)
            PictureBox8.Location = New Point(3.02 + PictureBox8.Location.X, Sin(20) + PictureBox8.Location.Y)
            PictureBox9.Location = New Point(3.02 + PictureBox9.Location.X, Sin(20) + PictureBox9.Location.Y)
            PictureBox10.Location = New Point(3.02 + PictureBox10.Location.X, Sin(20) + PictureBox10.Location.Y)
            PictureBox11.Location = New Point(3.02 + PictureBox11.Location.X, Sin(20) + PictureBox11.Location.Y)
            PictureBox12.Location = New Point(3.02 + PictureBox12.Location.X, Sin(20) + PictureBox12.Location.Y)
        End If

        Return 1
    End Function

    Private Sub Panel1_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles panelJeu.Click

    End Sub

    Private Sub FormPrincip_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ini()
        Alien_timer.Start()
        Vaisseau_timer.Start()
        collision_detect.Start()
    End Sub
    Private Sub FormPrincip_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Right Then      'Si appuie sur la touche fléchée DROITE
            If (vaisseau.Location.X > panelJeu.MaximumSize.Width) Then 'Si la position du vaisseau est supérieur à la taille du panel
                vaisseau.Location = New System.Drawing.Point(Me.vaisseau.Location.X = panelJeu.MaximumSize.Width, Me.vaisseau.Location.Y)
            End If
            Me.vaisseau.Location = New System.Drawing.Point(Me.vaisseau.Location.X + 7, Me.vaisseau.Location.Y)
        End If

        If e.KeyCode = Keys.Left Then   'Si appuie sur la touche fléchée GAUCHE
            If (vaisseau.Location.X < panelJeu.MinimumSize.Width) Then
                Me.vaisseau.Location = New System.Drawing.Point(Me.vaisseau.Location.X = 0, Me.vaisseau.Location.Y)
            End If
            Me.vaisseau.Location = New System.Drawing.Point(Me.vaisseau.Location.X - 7, Me.vaisseau.Location.Y)
        End If
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub Aliem_timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Alien_timer.Tick
        AlienMove()
    End Sub


    Private Sub collision_detect_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles collision_detect.Tick

    End Sub

    Private Sub Vaisseau_timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Vaisseau_timer.Tick

    End Sub

    Private Sub Missile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Missile.Click

    End Sub
End Class